package org.fasex
{
	public class Config
	{
		/**
		 * Sum heigth of images in menu 
		 */	
		public var menuH:Number;
		public var menuY:Number;
		public var coors:Array = new Array();
		//common
		public var delay:int;
		public var borderThickness:Number;
		public function Config(_xml:XML):void{
			//base
			var baseXML:XML = _xml.base[0];
			this.delay = Number(baseXML.@delay);
			this.borderThickness = baseXML.@borderThickness;
			//current image
			var xml:XML = _xml.image_current[0];
			coors.push(new ImageData(xml.@x,xml.@y,xml.@w,xml.@h));
			var menu:XML = _xml.image_menu[0];
			this.menuY = Number(menu.@y);
			var imgs:XMLList = _xml.image_menu[0].image;
			var _imgSum:int = imgs.length();
			for(var i:int=0;i<_imgSum;i++){
				if(i==0){
					coors[i].url = imgs[0].@url;
					coors[i].text = imgs[0].@text;
					coors[i].page = imgs[0].@page;
				}else{
					coors.push(new ImageData(menu.@x,this.menuY+Number((Number(menu.@h)+Number(menu.@space))*(i-1)),menu.@w,menu.@h,imgs[i].@url,imgs[i].@text,imgs[i].@page));
				}
			}
			//
			this.menuH = (_imgSum-2)*Number(menu.@space) + (_imgSum-1)*Number(menu.@h);
		}
	}
}